<?php
HBase::using('Backend.*');
HBase::using('DAL.*');
class backend_usersroles_edit extends HModule {
	public $data;
	function run(){
		if (isset($_POST['flag'])) {
			self::process();
		}
		else {
			$this->data = HUsersRoles::getOneRoleById($_GET['id']);
		}		
	}
	
	function process() {
		$id 	= $_GET['id'];
		$roleName = $_POST['tbxRoleName'];
		if (HUsersRoles::update($id, $roleName)){
			HUtil::alert("Update role successfully!");
		}else{ 
			HUtil::alert("ERROR: Update role unsuccessfully!");
		}
		HUtil::redirect(HCommon::navigateUrl('UsersRoles'));			
	}
}
?>